package com.gin.pixiv.deserializer

import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.core.JsonToken
import com.fasterxml.jackson.databind.DeserializationContext
import com.fasterxml.jackson.databind.JsonDeserializer
import com.gin.pixiv.response.ranking.IllustSeries

/**
 * @author BX-Gin
 * @from 2024/2/26 12:19
 */
class IllustSeriesDeserializer : JsonDeserializer<IllustSeries>() {
    override fun deserialize(jsonParser: JsonParser?, p1: DeserializationContext?): IllustSeries? {
        if (jsonParser?.hasToken(JsonToken.START_OBJECT) == true) {
            return jsonParser.codec?.readValue(jsonParser, IllustSeries::class.java)
        }
        return null
    }
}